//package com.laojiang.config;
//
//
//import com.laojiang.service.UserDaoService;
//import com.laojiang.service.impl.UserServiceImpl;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
//import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
//import org.springframework.security.config.annotation.web.builders.HttpSecurity;
//import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
//import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
//
//
//@Configuration
//public class SecurityConfiguartion extends WebSecurityConfigurerAdapter {
//
//    @Autowired
//    private UserDaoService myUserDetailsService;
//
//    @Override
//    protected void configure(HttpSecurity http) throws Exception {
//        //对请求进行认证
//        http.authorizeRequests()
//                .antMatchers("/login","/css/**","/font/**","/js/**","/img/**","/lib/**")
//                .permitAll().anyRequest().authenticated();
//        //修改为自己的登录页面
//        http.formLogin().loginPage("/login")
//                .defaultSuccessUrl("/");//解决偶尔出现登陆成功后的默认界面
//        //允许加载同源的其它页面
//        http.headers().frameOptions().sameOrigin();
//        //解决Invalid CSRF token found for http://localhost:8080/user/login
//        http.csrf().disable();
//    }
//
///*    @Override
//    public void configure(AuthenticationManagerBuilder auth) throws Exception {
//        auth.userDetailsService(myUserDetailsService).passwordEncoder(passwordEncoder());
//    }*/
//
//
//    @Bean
//    public BCryptPasswordEncoder passwordEncoder(){
//        return new BCryptPasswordEncoder();
//    }
//}
